
import serviceAxios from "./request";

export function getTree() {
  // console.log(serviceAxios);
  return serviceAxios({
    url: "/company/department",
    method: "get",
  });
};

export function logina(data:any) {
  // console.log(serviceAxios);
  return serviceAxios({
    url: "/sys/login",
    method: "post",
    data
  });
};

export function addList(data:any) {
  return serviceAxios({
    url: "/company/department",
    method: "post",
    data
  });
};


//获取考勤列表
export function getattend(page='',pagesize='',deptID=''){
  return serviceAxios({
    url: `/attendances?page=${page}&pagesize=${pagesize}&deptID=${deptID}`,
    method: "get"
  });
}

//查询考勤设置
export function getattendset(){
  return serviceAxios({
    url:'/cfg/atte/item',
    method:'get'
  })
}

//获取社保列表
export function getSyslist(page:any,pageSize:any,departmentChecks:string,providentFundChecks:string,socialSecurityChecks:string){
  return serviceAxios({
    url:`/social_securitys/list`,
    method:'post',
    data: {
      page,
      pageSize,
      departmentChecks,
      providentFundChecks,
      socialSecurityChecks
    }
  })
}

//获取当月社保报表详细数据
export function getyearlist(){
  return serviceAxios({
    url:`/social_securitys/historys/202301?opType=1`,
    method:'get'
  })
}

//批量导出当月社保报表
export function getyearall(){
  return serviceAxios({
    url:`/social_securitys/historys/{yearMonth:${'202301'}}/export`
  })
}

//查询社保历史归档列表
export function getlocallist(){
  return serviceAxios({
    url:`/social_securitys/historys/{year:${2020}}/list`
  })
}

//查询归档月份报表
export function getYearBackList(){
  return serviceAxios({
    url:`/social_securitys/historys/{yearMonth:${'202301'}}/archive`,
    method:'post'
  })
}


//创建新报表
export function setNewList(){
  return serviceAxios({
    url:`/social_securitys/historys/{yearMonth:${'202302'}}/newReport`,
    method:'put'
  })
}

// export function login(data) {
//   return serviceAxios({
//     url: "/sys/login",
//     method: "post",
//     data,
//   });
// };

//角色获取数据
// export function getRoleList(page: number, pagesize: number) {
//   return serviceAxios({
//     url: `/sys/role?page=${page}&pagesize=${pagesize}`,
//     method: "get",
//   })
// }

export function getrole() {
  // console.log(serviceAxios);
  return serviceAxios({
    url: "/sys/role/list/enabled",
    method: "get",
  });
};


export function pageRole(page:any,pagesize:any) {
  // console.log(serviceAxios);
  return serviceAxios({
    url: `/sys/role?page=${page}&pagesize=${pagesize}`,
    method: "get",
  });
};

export function addRole(data:any) {
  // console.log(serviceAxios);
  return serviceAxios({
    url: '/sys/role',
    method: "post",
    data
  });
};

export function getRolea(id:any) {
  // console.log(serviceAxios);
  return serviceAxios({
    url: `/sys/role/${id}`,
    method: "get",
  });
};

export function delRolea(id:any) {
  // console.log(serviceAxios);
  return serviceAxios({
    url: `/sys/role/${id}`,
    method: "delete",
  });
};

export function updrole(data:any) {
  // console.log(serviceAxios);
  return serviceAxios({
    url: `/sys/role/${data.id}`,
    method: "put",
    data
  });
};


export function assignPrem(arr:any) {
  // console.log(serviceAxios);
  return serviceAxios({
    url: `/sys/role/assignPrem`,
    method: "put",
    data:arr
  });
};

export function getPermission() {
  // console.log(serviceAxios);
  return serviceAxios({
    url: `/sys/permission`,
    method: "get",
  });
};


export function updPermission(data:any) {
  // console.log(serviceAxios);
  return serviceAxios({
    url: `/sys/permission/${data.id}`,
    method: "put",
    data
  });
};
//删除角色数据
// export function deleteRole(id:string){
//   return serviceAxios({
//     url: "/sys/role/{id}",
//     method: "delete",
//     id:id
//   })
// }

//审批获取数据
export function getReports(page:any,pageSize:any){
  return serviceAxios({
   url:`/user/process/instance/${page}/${pageSize}`,
   method:"get",
  })
 }
   
   
   export function getDetail(id:any){
  return serviceAxios({
   url:`/user/process/instance/${id}`,
   method:"get",
  })
 }
 
